<!--
 * @Description: 
 * @version: 
 * @Author: wind.wang
 * @Date: 2024-02-03 14:18:45
 * @LastEditors: wind.wang
 * @LastEditTime: 2024-02-03 17:55:05
-->
<script setup lang="ts">

import { ref, onMounted, getCurrentInstance, onUnmounted } from 'vue';

import { getToken } from '@/utils/auth';

import emitter from '@/utils/mitt';

import CommonHeader from '@/components/Header/CommonHeader.vue';

const instance = getCurrentInstance();

const isLogin = ref(true);

isLogin.value = !!getToken();

onMounted(() => {
  emitter.on('login', () => {
    isLogin.value = true;
  })

  emitter.on('logout', () => {
    isLogin.value = false;
  })
})

</script>

<template>
  <CommonHeader v-if="isLogin"></CommonHeader>
  <RouterView />
</template>

<style scoped>

</style>
